feat(cli): ulk agents stats — registry composition + count reconciliation (#1)#195
Merged
Conversation
…tion Implements chantier #1 (agent-usage-stats). New subcommand: ulk agents stats [--json] [--usage] [--source DIR] - Reads framework/agents/registry.json (source of truth) → composition by category / model / phase, with internal count-field consistency check. - Reconciles the agent count declared in registry.md / CLAUDE.md / AGENTS.md / framework/agents/CLAUDE.md against the registry, surfacing drift. - --usage overlays best-effort runtime usage from accountability.jsonl, with a loud attribution-coverage caveat (NEVER presented as proof of disuse). Reconciled the declared count to 98 everywhere (was 95 / 94). Design note (blocker): accountability.jsonl HAS an 'agent' field but attribution is not yet auto-propagated (protocol v1.1 → v1.2 roadmap), so most entries are 'unknown'. Per-agent invocation stats and reliable 'dead agent' detection are therefore NOT derivable today — the command reports attribution coverage instead of claiming disuse. This blocker should feed the accountability v1.2 work. New code: internal/registry/agents.go (loader + Stats + usage parser), cmd/agents.go (command + reconciliation). Tests: agents_test.go in both packages. go build + go vet + go test ./... all green. https://claude.ai/code/session_01JrFhrsWDBZVZBRMN6MiXG4
05ef8ab to
506987c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements chantier #1
agent-usage-statsfrom the « maturité v7 » epic (PR #194). Independent branch offmain.What it does
New Go subcommand:
framework/agents/registry.json(source of truth) — by category, model, phase, with an internalcount-field consistency check.registry.md,CLAUDE.md,AGENTS.md,framework/agents/CLAUDE.mdagainst the registry and flags drift.--usage— best-effort runtime overlay from.ulk-reports/accountability.jsonl, with a loud attribution-coverage caveat. Missing journal degrades gracefully.Sample output (this repo):
Count reconciliation (the card's first goal)
The drift was real: registry 98 vs CLAUDE.md 95 vs AGENTS.md/
agents/CLAUDE.md94. This PR:registry.json/registry.md(main was stale at 97 — first commit).accountability.jsonlhas anagentfield, but attribution is not yet auto-propagated (accountability protocol v1.1 → v1.2 roadmap) — most entries areagent: "unknown". So per-agent invocation stats and reliable "dead agent" detection are NOT derivable today.Consequence for the card's "identify dead trail (171→~40)" goal: the command cannot reliably flag unused agents yet. It reports attribution coverage instead of claiming disuse, and never presents absence of activity as proof. Unblocking this requires the accountability v1.2 auto-propagation work — a dependency worth surfacing in the epic.
Tests
go build+go vet+go test ./...all green. New tests: loader, Stats, count-field drift, accountability parsing + attribution ratio (internal/registry), declared-count regex against the 4 real doc phrasings + sort helper (cmd).Code
framework/cli/internal/registry/agents.go— loader +Stats()+LoadAgentUsage()(parsing/computation)framework/cli/cmd/agents.go— command + reconciliation + rendering (thin adapter)https://claude.ai/code/session_01JrFhrsWDBZVZBRMN6MiXG4
Generated by Claude Code